<extend name="common/base" />
<block name="body">
	<table class="table table-striped"
        data-options="{
            showCheckboxcol:true,
            showToolbar: true,
            toolbarItem: 'all',
            editUrl: '{:url('createGroup')}',
            delUrl: '{:url('changestatus', array('method'=>'deleteGroup'))}',
            enableUrl: '{:url('changestatus', array('method'=>'resumeGroup'))}',
            disableUrl: '{:url('changestatus', array('method'=>'forbidGroup'))}',
            dataUrl: '{:url('getDatas')}',
            columns:[
                {
                    name: 'title',
                    label: '用户组',
                    align: 'left',
                    width: '80'
                },
                {
                    label: '描述',
                    name: 'description',
                    align: 'left',
                    width: '140',
                },
                {
                    label: '状态',
                    name: 'status_text',
                    align: 'left',
                    width: '160',
                },
                {
                    label: '授权',
                    name: 'id',
                    width: 180,
                    render: function(cell, row){
                        if(typeof(row)==='undefined') return false;
                        return shouQuan(row);
                    }
                }
            ]
        }"
        data-toggle="datagrid"
    >
    </table>
</block>

<block name="script">
<script type="text/javascript" charset="utf-8">
    function shouQuan(row) {
        var url = '{:url('Auth/access')}';
        url+=(url.indexOf('?')>=0)?'&':'?';
        var para = 'group_name='+row.title+'&group_id='+row.id;
        var html = '';
        html += '<a href="'+url+para+'" data-toggle="dialog">访问授权</a>&nbsp;';
        var url = '{:url('Auth/category')}';
        url+=(url.indexOf('?')>=0)?'&':'?';
        html += '<a href="'+url+para+'" data-toggle="dialog">分类授权</a>&nbsp;';
        var url = '{:url('Auth/user')}';
        url+=(url.indexOf('?')>=0)?'&':'?';
        html += '<a href="'+url+para+'" data-toggle="dialog">成员授权</a>&nbsp;';
        return html;
    }
</script>
</block>